<?php
/*****************************************************************************\
+-----------------------------------------------------------------------------+
| X-Cart                                                                      |
| Copyright (c) 2001-2007 Ruslan R. Fazliev <rrf@rrf.ru>                      |
| All rights reserved.                                                        |
+-----------------------------------------------------------------------------+
| PLEASE READ  THE FULL TEXT OF SOFTWARE LICENSE AGREEMENT IN THE "COPYRIGHT" |
| FILE PROVIDED WITH THIS DISTRIBUTION. THE AGREEMENT TEXT IS ALSO AVAILABLE  |
| AT THE FOLLOWING URL: http://www.x-cart.com/license.php                     |
|                                                                             |
| THIS  AGREEMENT  EXPRESSES  THE  TERMS  AND CONDITIONS ON WHICH YOU MAY USE |
| THIS SOFTWARE   PROGRAM   AND  ASSOCIATED  DOCUMENTATION   THAT  RUSLAN  R. |
| FAZLIEV (hereinafter  referred to as "THE AUTHOR") IS FURNISHING  OR MAKING |
| AVAILABLE TO YOU WITH  THIS  AGREEMENT  (COLLECTIVELY,  THE  "SOFTWARE").   |
| PLEASE   REVIEW   THE  TERMS  AND   CONDITIONS  OF  THIS  LICENSE AGREEMENT |
| CAREFULLY   BEFORE   INSTALLING   OR  USING  THE  SOFTWARE.  BY INSTALLING, |
| COPYING   OR   OTHERWISE   USING   THE   SOFTWARE,  YOU  AND  YOUR  COMPANY |
| (COLLECTIVELY,  "YOU")  ARE  ACCEPTING  AND AGREEING  TO  THE TERMS OF THIS |
| LICENSE   AGREEMENT.   IF  YOU    ARE  NOT  WILLING   TO  BE  BOUND BY THIS |
| AGREEMENT, DO  NOT INSTALL OR USE THE SOFTWARE.  VARIOUS   COPYRIGHTS   AND |
| OTHER   INTELLECTUAL   PROPERTY   RIGHTS    PROTECT   THE   SOFTWARE.  THIS |
| AGREEMENT IS A LICENSE AGREEMENT THAT GIVES  YOU  LIMITED  RIGHTS   TO  USE |
| THE  SOFTWARE   AND  NOT  AN  AGREEMENT  FOR SALE OR FOR  TRANSFER OF TITLE.|
| THE AUTHOR RETAINS ALL RIGHTS NOT EXPRESSLY GRANTED BY THIS AGREEMENT.      |
|                                                                             |
| The Initial Developer of the Original Code is Ruslan R. Fazliev             |
| Portions created by Ruslan R. Fazliev are Copyright (C) 2001-2007           |
| Ruslan R. Fazliev. All Rights Reserved.                                     |
+-----------------------------------------------------------------------------+
\*****************************************************************************/

#
# $Id: cc_multicard.php,v 1.19.2.5 2007/03/22 13:55:10 svowl Exp $
#

if (!isset($REQUEST_METHOD))
        $REQUEST_METHOD = $HTTP_SERVER_VARS["REQUEST_METHOD"];

if ($REQUEST_METHOD == "POST" && isset($HTTP_POST_VARS["Proceed"]) && isset($HTTP_POST_VARS["order_num"]) && isset($HTTP_POST_VARS["user1"])) {
	require "./auth.php";

	if (!func_is_active_payment("cc_multicard.php"))
		exit;

#  'total_us_amount' => '',
#  'order_num' => '703100.3278936',
#  'user1' => '6',
#  'Proceed' => 'CONTINUE to AdultPremiumContent.com',

	$bill_output["sessid"] = func_query_first_cell("SELECT sessionid FROM $sql_tbl[cc_pp3_data] WHERE ref='".$HTTP_POST_VARS["user1"]."'");

	$bill_output["code"] = 1;
	$bill_output["billmes"] = " OrderNumber: ".$HTTP_POST_VARS["order_num"];

	require($xcart_dir."/payment/payment_ccend.php");

} else {
	if (!defined('XCART_START')) { header("Location: ../"); die("Access denied"); }

	$_orderids = $module_params ["param04"].join("-",$secure_oid);
	if (!$duplicate)
		db_query("REPLACE INTO $sql_tbl[cc_pp3_data] (ref,sessionid) VALUES ('".addslashes($_orderids)."','".$XCARTSESSID."')");

	$post = array(
		"user1" => $_orderids,
		"mer_id" => $module_params["param01"],
		"mer_url_idx" => $module_params["param02"],
		"cust_name" => $ship_name,
		"cust_company" => $userinfo['company'],
		"info1" => $userinfo['s_address'].", ".$userinfo['s_city'].", ".$userinfo['s_zipcode'].($userinfo['s_statename'] ? ", ".$userinfo['s_statename'] : "").", ".$userinfo['s_countryname'],
		"cust_email" => $userinfo["email"],
		"cust_phone" => $userinfo["phone"],
		"cust_fax" => $userinfo["fax"],
		"cust_address1" => $userinfo["b_address"],
		"cust_zip" => empty($userinfo["b_zipcode"]) ? "99999" : $userinfo["b_zipcode"],
		"cust_city" => $userinfo["b_city"],
		"cust_state" => $userinfo["b_state"],
		"cust_country" => $userinfo["b_countryname"],
		"pay_method_type" => $pay_method_type,
		"agree2terms" => "1",
		"num_items" => "1",
		"item1_desc" => "Order # ".$_orderids,
		"item1_price" => $cart["total_cost"],
		"item1_qty" => "1",
		"langcode" => $module_params["param03"],
		"card_name" => $bill_name,
		"next_phase" => "paydata"
	);

	func_create_payment_form("https://secure.multicards.com/cgi-bin/order2/processorder1.pl", $post, "MultiCards");
}
	exit;
?>

